﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="insertStudentData.aspx.cs" Inherits="StudentData_insertStudentData" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>InsertStudentData</title>
    <style type="text/css">
        .style1
        {
            font-family: 微軟正黑體;
            font-size: xx-large;
        }
        .style2
        {
            width: 80%;
        }
        .style3
        {
            font-size: large;
            font-family: 微軟正黑體;
        }
        .style4
        {
            text-align: left;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div style="text-align: center">
    
        <span class="style1">新增學生資料</span><br class="style1" />
        <br />
        <br />
        <table class="style2" align="center">
            <tr>
                <td>
                    <span class="style3">目前時間：</span><asp:Label ID="Label1" runat="server" 
                        CssClass="style3"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                                    <asp:Label ID="Label2" runat="server" style="color: #FF0000" 
                        Text="班級未建立"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
    
        <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" BackColor="#FFFBD6" 
            BorderColor="#FFDFAD" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" 
            Height="636px" style="font-family: 微軟正黑體; font-size: small; " 
            Width="336px" oncreateduser="CreateUserWizard1_CreatedUser" DisplayCancelButton="True" 
                        LoginCreatedUser="False">
            <ContinueButtonStyle BackColor="White" BorderColor="#CC9966" 
                BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" 
                ForeColor="#990000" />
            <CreateUserButtonStyle BackColor="White" BorderColor="#CC9966" 
                BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" 
                ForeColor="#990000" />
            <TitleTextStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <WizardSteps>
                <asp:CreateUserWizardStep runat="server" >
                    <ContentTemplate>
                        <table style="background-color:#FFFBD6;font-family:Verdana;font-size:100%;height:661px; width:434px;">
                            <tr>
                                <td align="center" colspan="2" 
                                    style="color:White;background-color:#990000;font-weight:bold;">
                                    新增學生資料</td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">學生證號(登入帳號):</asp:Label>
                                </td>
                                <td class="style4">
                                    <asp:TextBox ID="UserName" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" 
                                        ControlToValidate="UserName" ErrorMessage="必須提供使用者名稱。" ToolTip="必須提供使用者名稱。" 
                                        ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    姓名:</td>
                                <td class="style4">
                                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    身分證號:</td>
                                <td class="style4">
                                    <asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True" 
                                        ontextchanged="TextBox2_TextChanged"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    班級名稱:</td>
                                <td class="style4">
                                    <asp:TextBox ID="TextBox8" runat="server" AutoPostBack="True" 
                                        ontextchanged="TextBox8_TextChanged"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    性別:</td>
                                <td class="style4">
                                    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">密碼:</asp:Label>
                                </td>
                                <td class="style4">
                                    <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" 
                                        ControlToValidate="Password" ErrorMessage="必須提供密碼。" ToolTip="必須提供密碼。" 
                                        ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="ConfirmPasswordLabel" runat="server" 
                                        AssociatedControlID="ConfirmPassword">確認密碼:</asp:Label>
                                </td>
                                <td class="style4">
                                    <asp:TextBox ID="ConfirmPassword" runat="server" TextMode="Password"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="ConfirmPasswordRequired" runat="server" 
                                        ControlToValidate="ConfirmPassword" ErrorMessage="必須提供確認密碼。" 
                                        ToolTip="必須提供確認密碼。" ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">電子郵件:</asp:Label>
                                </td>
                                <td class="style4">
                                    <asp:TextBox ID="Email" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="EmailRequired" runat="server" 
                                        ControlToValidate="Email" ErrorMessage="必須提供電子郵件。" ToolTip="必須提供電子郵件。" 
                                        ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    出生日期:</td>
                                <td class="style4">
                                    <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    地址:</td>
                                <td class="style4">
                                    <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    電話:</td>
                                <td class="style4">
                                    <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    手機:</td>
                                <td class="style4">
                                    <asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="QuestionLabel" runat="server" AssociatedControlID="Question">安全性問題:</asp:Label>
                                </td>
                                <td class="style4">
                                    <asp:TextBox ID="Question" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="QuestionRequired" runat="server" 
                                        ControlToValidate="Question" ErrorMessage="必須提供安全性問題。" ToolTip="必須提供安全性問題。" 
                                        ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="AnswerLabel" runat="server" AssociatedControlID="Answer">安全性解答:</asp:Label>
                                </td>
                                <td class="style4">
                                    <asp:TextBox ID="Answer" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="AnswerRequired" runat="server" 
                                        ControlToValidate="Answer" ErrorMessage="必須提供安全性解答。" ToolTip="必須提供安全性解答。" 
                                        ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    緊急聯絡人姓名:</td>
                                <td class="style4">
                                    <asp:TextBox ID="TextBox9" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="AnswerRequired0" runat="server" 
                                        ControlToValidate="TextBox9" ErrorMessage="必須提供安全性解答。" ToolTip="緊急聯絡人姓名未填。" 
                                        ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    關係:</td>
                                <td class="style4">
                                    <asp:TextBox ID="TextBox11" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="AnswerRequired2" runat="server" 
                                        ControlToValidate="TextBox11" ErrorMessage="必須提供安全性解答。" ToolTip="緊急連絡人關係未填。" 
                                        ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    緊急連絡人電話:</td>
                                <td class="style4">
                                    <asp:TextBox ID="TextBox10" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="AnswerRequired1" runat="server" 
                                        ControlToValidate="TextBox10" ErrorMessage="必須提供安全性解答。" ToolTip="請提供緊急連絡電話。" 
                                        ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="center" colspan="2">
                                    <asp:CompareValidator ID="PasswordCompare" runat="server" 
                                        ControlToCompare="Password" ControlToValidate="ConfirmPassword" 
                                        Display="Dynamic" ErrorMessage="密碼和確認密碼必須相符。" 
                                        ValidationGroup="CreateUserWizard1"></asp:CompareValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="center" colspan="2" style="color:Red;">
                                    <asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </asp:CreateUserWizardStep>
                <asp:CompleteWizardStep runat="server" >
                    <ContentTemplate>
                        <table style="background-color:#FFFBD6;font-family:Verdana;font-size:100%;height:327px;width:336px;">
                            <tr>
                                <td align="center" 
                                    style="color:White;background-color:#990000;font-weight:bold;">
                                    完成</td>
                            </tr>
                            <tr>
                                <td>
                                    已經成功建立您的帳戶。<br /> 
                                    <br />
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <asp:Button ID="ContinueButton" runat="server" BackColor="White" 
                                        BorderColor="#CC9966" BorderStyle="Solid" BorderWidth="1px" 
                                        CausesValidation="False" CommandName="Continue" Font-Names="Verdana" 
                                        ForeColor="#990000" Text="繼續" ValidationGroup="CreateUserWizard1" />
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </asp:CompleteWizardStep>
            </WizardSteps>
            <HeaderStyle BackColor="#FFCC66" BorderColor="#FFFBD6" BorderStyle="Solid" 
                BorderWidth="2px" Font-Bold="True" Font-Names="微軟正黑體" Font-Size="Medium" 
                ForeColor="#333333" HorizontalAlign="Center" />
            <NavigationButtonStyle BackColor="White" BorderColor="#CC9966" 
                BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" 
                ForeColor="#990000" />
            <SideBarButtonStyle ForeColor="White" />
            <SideBarStyle BackColor="#990000" Font-Size="0.9em" VerticalAlign="Top" />
        </asp:CreateUserWizard>
                </td>
            </tr>
            <tr>
                <td>
                    <span class="style3">目前班級名單：<asp:DropDownList ID="DropDownList1" runat="server" 
                        AutoPostBack="True" DataSourceID="SqlDataSource4" DataTextField="DepartmentName" 
                        DataValueField="DepartmentId">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ProjectConnectionString %>" 
                        SelectCommand="SELECT [DepartmentId], [DepartmentName] FROM [Department]"></asp:SqlDataSource>
                    </span></td>
            </tr>
            <tr>
                <td>
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                        CellPadding="4" DataKeyNames="StudentId" DataSourceID="SqlDataSource5" 
                        ForeColor="#333333" GridLines="None" Width="1001px">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:BoundField DataField="DepartmentName" HeaderText="班別" 
                                SortExpression="DepartmentName" ReadOnly="True" />
                            <asp:BoundField DataField="StudentId" HeaderText="學生證號" ReadOnly="True" 
                                SortExpression="StudentId" />
                            <asp:BoundField DataField="StudentName" HeaderText="姓名" 
                                SortExpression="StudentName" />
                            <asp:BoundField DataField="Gender" HeaderText="性別" 
                                SortExpression="Gender" />
                            <asp:BoundField DataField="Birth" HeaderText="出生日期" 
                                SortExpression="Birth" DataFormatString="{0:d}" />
                            <asp:BoundField DataField="Email" HeaderText="電子信箱" 
                                SortExpression="Email" />
                            <asp:BoundField DataField="SSN" HeaderText="身分證號" 
                                SortExpression="SSN" />
                            <asp:BoundField DataField="Address" HeaderText="地址" 
                                SortExpression="Address" />
                            <asp:CommandField ButtonType="Button" ShowEditButton="True" />
                        </Columns>
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ProjectConnectionString %>" 
                        DeleteCommand="DELETE FROM [Student] WHERE [StudentId] = @StudentId" 
                        InsertCommand="INSERT INTO [Student] ([StudentId], [StudentName], [Birth], [Email], [Gender], [SelfIntro], [Address], [SSN]) VALUES (@StudentId, @StudentName, @Birth, @Email, @Gender, @SelfIntro, @Address, @SSN)" 
                        SelectCommand="SELECT DISTINCT Student.StudentId, Student.StudentName, Student.Birth, Student.Email, Student.Gender, Student.SelfIntro, Student.Address, Student.SSN, Department.DepartmentName, Student.DepartmentId FROM Student LEFT OUTER JOIN Department ON Student.DepartmentId = Department.DepartmentId WHERE (Student.DepartmentId = @ID)" 
                        
                        
                        
                        UpdateCommand="UPDATE Student SET StudentName = @StudentName, Birth = @Birth, Email = @Email, Gender = @Gender, Address = @Address, SSN = @SSN FROM Student INNER JOIN StudentCellPhone ON Student.StudentId = StudentCellPhone.StudentId INNER JOIN StudentPhone ON Student.StudentId = StudentPhone.StudentId WHERE (Student.StudentId = @StudentId)">
                        <DeleteParameters>
                            <asp:Parameter Name="StudentId" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="StudentId" Type="Int32" />
                            <asp:Parameter Name="StudentName" Type="String" />
                            <asp:Parameter DbType="Date" Name="Birth" />
                            <asp:Parameter Name="Email" Type="String" />
                            <asp:Parameter Name="Gender" Type="String" />
                            <asp:Parameter Name="SelfIntro" Type="String" />
                            <asp:Parameter Name="Address" Type="String" />
                            <asp:Parameter Name="SSN" Type="String" />
                        </InsertParameters>
                        <SelectParameters>
                            <asp:ControlParameter ControlID="DropDownList1" Name="ID" 
                                PropertyName="SelectedValue" />
                        </SelectParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="StudentName" Type="String" />
                            <asp:Parameter DbType="Date" Name="Birth" />
                            <asp:Parameter Name="Email" Type="String" />
                            <asp:Parameter Name="Gender" Type="String" />
                            <asp:Parameter Name="Address" Type="String" />
                            <asp:Parameter Name="SSN" Type="String" />
                            <asp:Parameter Name="StudentId" Type="Int32" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                        DataSourceID="SqlDataSource4" DataKeyNames="DepartmentId" Visible="False">
                        <Columns>
                            <asp:BoundField DataField="DepartmentName" HeaderText="DepartmentName" 
                                SortExpression="DepartmentName" />
                            <asp:BoundField DataField="DepartmentId" HeaderText="DepartmentId" 
                                SortExpression="DepartmentId" InsertVisible="False" ReadOnly="True" />
                        </Columns>
                    </asp:GridView>
                </td>
            </tr>
        </table>
        <br />
        <br />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ProjectConnectionString %>" 
            DeleteCommand="DELETE FROM [Student] WHERE [StudentId] = @StudentId" 
            InsertCommand="INSERT INTO Student(StudentId, StudentName, Birth, Email, Gender, Address, SSN, DepartmentId) VALUES (@StudentId, @StudentName, @Birth, @Email, @Gender, @Address, @SSN, @DepartmentId)" 
            SelectCommand="SELECT StudentId, StudentName, Birth, Email, Gender, SelfIntro, Address, SSN, DepartmentId FROM Student" 
            
            
            
            UpdateCommand="UPDATE [Student] SET [StudentName] = @StudentName, [Birth] = @Birth, [Email] = @Email, [Gender] = @Gender, [SelfIntro] = @SelfIntro, [Address] = @Address, [insertDate] = @insertDate, [SSN] = @SSN WHERE [StudentId] = @StudentId">
            <DeleteParameters>
                <asp:Parameter Name="StudentId" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:SessionParameter Name="StudentId" SessionField="id" Type="Int32" />
                <asp:SessionParameter Name="StudentName" SessionField="name" Type="String" />
                <asp:SessionParameter DbType="Date" Name="Birth" SessionField="birth" />
                <asp:SessionParameter Name="Email" SessionField="email" Type="String" />
                <asp:SessionParameter Name="Gender" SessionField="gender" Type="String" />
                <asp:SessionParameter Name="Address" SessionField="address" Type="String" />
                <asp:SessionParameter Name="SSN" SessionField="ssn" Type="String" />
                <asp:SessionParameter Name="DepartmentId" SessionField="class" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="StudentName" Type="String" />
                <asp:Parameter DbType="Date" Name="Birth" />
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Gender" Type="String" />
                <asp:Parameter Name="SelfIntro" Type="String" />
                <asp:Parameter Name="Address" Type="String" />
                <asp:Parameter DbType="Date" Name="insertDate" />
                <asp:Parameter Name="SSN" Type="String" />
                <asp:Parameter Name="StudentId" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ProjectConnectionString %>" 
            DeleteCommand="DELETE FROM [StudentPhone] WHERE [StudentId] = @StudentId" 
            InsertCommand="INSERT INTO [StudentPhone] ([StudentId], [Phone]) VALUES (@StudentId, @Phone)" 
            SelectCommand="SELECT * FROM [StudentPhone]" 
            UpdateCommand="UPDATE [StudentPhone] SET [Phone] = @Phone WHERE [StudentId] = @StudentId">
            <DeleteParameters>
                <asp:Parameter Name="StudentId" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:SessionParameter Name="StudentId" SessionField="id" Type="Int32" />
                <asp:SessionParameter Name="Phone" SessionField="phone" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Phone" Type="String" />
                <asp:Parameter Name="StudentId" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ProjectConnectionString %>" 
            DeleteCommand="DELETE FROM [StudentCellPhone] WHERE [StudentId] = @StudentId" 
            InsertCommand="INSERT INTO [StudentCellPhone] ([StudentId], [CellPhone]) VALUES (@StudentId, @CellPhone)" 
            SelectCommand="SELECT * FROM [StudentCellPhone]" 
            UpdateCommand="UPDATE [StudentCellPhone] SET [CellPhone] = @CellPhone WHERE [StudentId] = @StudentId">
            <DeleteParameters>
                <asp:Parameter Name="StudentId" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:SessionParameter Name="StudentId" SessionField="id" Type="Int32" />
                <asp:SessionParameter Name="CellPhone" SessionField="cellPhone" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="CellPhone" Type="String" />
                <asp:Parameter Name="StudentId" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource6" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ProjectConnectionString %>" 
            DeleteCommand="DELETE FROM [EmergencyContact] WHERE [StudentId] = @StudentId" 
            InsertCommand="INSERT INTO [EmergencyContact] ([StudentId], [Name], [Relation]) VALUES (@StudentId, @Name, @Relation)" 
            SelectCommand="SELECT * FROM [EmergencyContact]" 
            UpdateCommand="UPDATE [EmergencyContact] SET [Name] = @Name, [Relation] = @Relation WHERE [StudentId] = @StudentId">
            <DeleteParameters>
                <asp:Parameter Name="StudentId" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:SessionParameter Name="StudentId" SessionField="id" Type="Int32" />
                <asp:SessionParameter Name="Name" SessionField="emergencyName" Type="String" />
                <asp:SessionParameter Name="Relation" SessionField="relation" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Relation" Type="String" />
                <asp:Parameter Name="StudentId" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource7" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ProjectConnectionString %>" 
            DeleteCommand="DELETE FROM [EmergencyContactPhone] WHERE [serial] = @serial" 
            InsertCommand="INSERT INTO [EmergencyContactPhone] ([StudentId], [Phone]) VALUES (@StudentId, @Phone)" 
            SelectCommand="SELECT * FROM [EmergencyContactPhone]" 
            UpdateCommand="UPDATE [EmergencyContactPhone] SET [StudentId] = @StudentId, [Phone] = @Phone WHERE [serial] = @serial">
            <DeleteParameters>
                <asp:Parameter Name="serial" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:SessionParameter Name="StudentId" SessionField="id" Type="Int32" />
                <asp:SessionParameter Name="Phone" SessionField="emergencyPhone" 
                    Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="StudentId" Type="Int32" />
                <asp:Parameter Name="Phone" Type="String" />
                <asp:Parameter Name="serial" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <br />
    
    </div>
    </form>
</body>
</html>
